<%--
  Created by IntelliJ IDEA.
  User: xiaoji
  Date: 2014/12/29
  Time: 10:13
  To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib prefix="spring" uri="/WEB-INF/lib/spring.tld"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title><spring:message code='usercenter.index.title' /></title>
    <link href="${path}/style/acg/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" media="screen" href="${path}/plugins/validate/validate.css">
    <script src="${path}/js/jquery.min.js" type="text/javascript"></script>
    <script src="${path}/plugins/validate/jquery.validate.min.js" type="text/javascript"></script>
    <c:if test="${ sessionScope.language != 'en'}">
        <script src="${path}/plugins/validate/messages_cn.js" type="text/javascript"></script>
    </c:if>
    <!-- 文件上传JS -->
    <script type="text/javascript" src="${path}/js/ajaxfileupload.js"></script>
</head>
<body>
<jsp:include page="../public/header.jsp">
    <jsp:param    name="usercenter"    value="true"    />
</jsp:include>
<jsp:include page="../usercenter/leftMenu.jsp"></jsp:include>

<style type="text/css">
    .txtPass{
        width: 220px;
        height: 38px;
        line-height: 38px;
        border: 1px solid #DDDDDD;
        padding: 0 10px;
    }
</style>
<div class="member_box">
    <div class="member_title">
        <ul>
            <li class="hover"><a href="javascript:void(0);"><spring:message code='usercenter.userInfo.msg1' /></a></li>
            <li><a href="${path}/usercenter/topup.html" ><spring:message code='usercenter.userInfo.msg2' /></a></li>
            <li><a href="${path}/usercenter/withdrawal.html"><spring:message code='usercenter.userInfo.msg3' /></a></li>
        </ul>
    </div>
    <div class="member_account">
        <div class="member_form">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><img src="${path}/${sessionScope.curUser.headPortrait}" width="70" height="70" class="avatar"></dt>
                        <dd>
                            <p><spring:message code='usercenter.userInfo.msg4' />${sessionScope.curUser.nickname==null?sessionScope.curUser.userName:sessionScope.curUser.nickname}</p>

                            <p><input type="buttom" onclick="openWin(3)"  value="<spring:message code='usercenter.userInfo.msg5' />" class="abtn edit_avatar"></p>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg6' /></dt>
                        <dd><label>${sessionScope.curUser.realName}</label>
                            <c:if test="${sessionScope.curUser.nameAuth!=101001}">
                                <input type="button" onclick="openWin(1)" value="<spring:message code='usercenter.userInfo.msg7' />" class="abtn">
                            </c:if>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg8' /></dt>
                        <dd><label>${sessionScope.curUser.email}</label>
                            <c:if test="${sessionScope.curUser.emailAuth==101001}">
                                <label class="abtn"><spring:message code='usercenter.userInfo.msg58' /></label>
                                <input type="button" onclick="openWin(4)"  value="<spring:message code='usercenter.userInfo.msg59' />" class="abtn">
                            </c:if>
                            <c:if test="${sessionScope.curUser.emailAuth!=101001}">
                                <input type="button" onclick="openWin(4)"  value="<spring:message code='usercenter.userInfo.msg7' />" class="abtn">
                            </c:if>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg9' /></dt>
                        <dd><label>${sessionScope.curUser.phone}</label><input type="button" onclick="openWin(5)"  value="<spring:message code='usercenter.userInfo.msg60' />" class="abtn"></dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg10' /></dt>
                        <dd><label>${sessionScope.curUser.qq}</label><input type="button" onclick="openWin(6)"  value="<spring:message code='usercenter.userInfo.msg60' />" class="abtn"></dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg51' />：</dt>
                        <dd><label>${sessionScope.curUser.alipay}</label><input type="button" onclick="openWin(7)"  value="<spring:message code='usercenter.userInfo.msg60' />" class="abtn"></dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd><input type="submit" id="" name="" onclick="openWin(2)" value="<spring:message code='usercenter.userInfo.msg11' />" class="btn60"></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--弹出框-账户认证信息-->
<form id="frm1">
<div id="openwin1" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox1" class="openbox" style="margin-top: 50.5px;">
        <h1><spring:message code='usercenter.userInfo.msg12' /><span id="closeopen1" class="closeopen" onclick="closeWin(1)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg13' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="text" id="realName" name="realName" value="${sessionScope.curUser.realName}"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg14' /></dt>
                        <dd>
                            <div class="clearfix">
                                <label class="btnload" for="fulAchievements1"><spring:message code='usercenter.userInfo.msg15' /></label>
                                <input style="display: none" type="file" name="file" id="fulAchievements1" onchange="f_file_upload(1)"  />
                                <input type="hidden" name="attachment1" id="attachment1" value="${sessionScope.curUser.idCard}">
                            </div>
                            <div class="imglist" id="imglist1">
                            <c:forTokens items="${sessionScope.curUser.idCard}" delims="," var="imgurl" varStatus="k">
                                <span id="img_1_exist${k.index}" surl="${imgurl}"><img  src="${path}/${imgurl}" width="70" height="70" /><em class="ico_del" onclick="deleteImg('exist${k.index}',1)">×</em></span>
                            </c:forTokens>
                            </div>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg16' /></dt>
                        <dd>
                            <div class="clearfix">
                                <label class="btnload"  for="fulAchievements2"><spring:message code='usercenter.userInfo.msg15' /></label>
                                <input style="display: none" type="file" name="file" id="fulAchievements2" onchange="f_file_upload(2)"  />
                                <input type="hidden" name="attachment2" id="attachment2" value="${sessionScope.curUser.businessLicense}">
                            </div>
                            <div class="imglist" id="imglist2">
                                <c:forTokens items="${sessionScope.curUser.businessLicense}" delims="," var="imgurl" varStatus="k">
                                    <span id="img_2_exist${k.index}" surl="${imgurl}"><img  src="${path}/${imgurl}" width="70" height="70" /><em class="ico_del" onclick="deleteImg('exist${k.index}',2)">×</em></span>
                                </c:forTokens>
                            </div>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg17' /></dt>
                        <dd>
                            <div class="clearfix">
                                <label class="btnload"  for="fulAchievements3"><spring:message code='usercenter.userInfo.msg15' /></label>
                                <input style="display: none" type="file" name="file" id="fulAchievements3" onchange="f_file_upload(3)"  />
                                <input type="hidden" name="attachment3" id="attachment3" value="${sessionScope.curUser.cer}">
                            </div>
                            <div class="imglist" id="imglist3">
                                <c:forTokens items="${sessionScope.curUser.cer}" delims="," var="imgurl" varStatus="k">
                                    <span id="img_3_exist${k.index}" surl="${imgurl}"><img  src="${path}/${imgurl}" width="70" height="70" /><em class="ico_del" onclick="deleteImg('exist${k.index}',3)">×</em></span>
                                </c:forTokens>
                            </div>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit" id="" name="" value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-修改密码-->
<form id="frm2">
<div id="openwin2" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox2" class="openbox" style="margin-top: 108.5px;">
        <h1><spring:message code='usercenter.userInfo.msg11' /><span id="closeopen2" class="closeopen" onclick="closeWin(2)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg19' /></dt>
                        <dd style="width: 500px">
                             <input class="txtPass" type="password" id="oldPassword" name="oldPassword"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg20' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="password" id="newPassword" name="newPassword"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg21' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="password" id="repeatPassword" name="repeatPassword"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit" id="modifyPassword" name="modifyPassword" value="<spring:message code='usercenter.userInfo.msg11' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-修改头像-->
<form id="frm3">
<div id="openwin3" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox3" class="openbox" style="margin-top: 108.5px;">
        <h1><spring:message code='usercenter.userInfo.msg22' /><span id="closeopen3" class="closeopen" onclick="closeWin(3)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg23' /></dt>
                        <dd>
                            <div class="clearfix">
                                <label class="btnload" for="fulAchievements4"><spring:message code='usercenter.userInfo.msg15' /></label>
                                <input style="display: none" type="file" name="file" id="fulAchievements4" onchange="f_file_upload_single(4)"  />
                                <input type="hidden" name="attachment4" id="attachment4" value="${sessionScope.curUser.headPortrait}">
                            </div>
                            <div class="imglist" id="imglist4">
                                <c:if test="${sessionScope.curUser.headPortrait != ''}">
                                <span id="imgsingle4"><img src="${path}/${sessionScope.curUser.headPortrait}" width="70" height="70" /></span>
                                </c:if>
                            </div>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit" id="" name="" value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-电子邮箱-->
<form id="frm4">
<div id="openwin4" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox4" class="openbox" style="margin-top: 108.5px;">
        <h1><spring:message code='usercenter.userInfo.msg24' /><span id="closeopen4" class="closeopen" onclick="closeWin(4)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg25' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="text" id="email" name="email" value="${sessionScope.curUser.email}"/>
                            <input id="sendEmailButton" type="button" value="发送动态码" onclick="sendCode()"/>
                        </dd>
                    </dl>
                </li>
                <script>
                    function sendCode(){
                        $("#sendEmailButton").attr("disabled", "disabled");
                        $.post("${path}/usercenter/sendEmail.html",{email:$("#email").val()},function(data){
                                 var i=60;
                                 setInterval(function(){
                                     if(i>0){
                                         $("#sendEmailButton").val("重新发送("+i+")");
                                         $("#sendEmailButton").attr("disabled","disabled");
                                         i--;
                                     }else{
                                         $("#sendEmailButton").val("重新发送");
                                         $("#sendEmailButton").removeAttr("disabled");
                                     }

                                 },1000);
                        },"json");
                    }
                </script>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg57' />：</dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="text" id="code" name="code" value="" request="true"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit"  value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-手机号码-->
<form id="frm5">
<div id="openwin5" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox5" class="openbox" style="margin-top: 108.5px;">
        <h1><spring:message code='usercenter.userInfo.msg26' /><span id="closeopen5" class="closeopen" onclick="closeWin(5)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg27' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="text" id="phone" name="phone" value="${sessionScope.curUser.phone}"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit"  value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-qq-->
<form id="frm6">
<div id="openwin6" class="openwin" style="width: 1382px; height: 600px;display: none">
    <div id="openbox6" class="openbox" style="margin-top: 108.5px;">
        <h1><spring:message code='usercenter.userInfo.msg28' /><span id="closeopen6" class="closeopen" onclick="closeWin(6)">×</span></h1>
        <div class="openmain">
            <ul>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt><spring:message code='usercenter.userInfo.msg29' /></dt>
                        <dd style="width: 500px">
                            <input class="txtPass" type="text" id="userqq" name="userqq" value="${sessionScope.curUser.qq}"/>
                        </dd>
                    </dl>
                </li>
                <li class="clearfix">
                    <dl class="clearfix">
                        <dt>&nbsp;</dt>
                        <dd>
                            <input type="submit" value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<!--弹出框-支付宝-->
<form id="frm7">
    <div id="openwin7" class="openwin" style="width: 1382px; height: 600px;display: none">
        <div id="openbox7" class="openbox" style="margin-top: 108.5px;">
            <h1><spring:message code='usercenter.userInfo.msg54' /><span id="closeopen7" class="closeopen" onclick="closeWin(7)">×</span></h1>
            <div class="openmain">
                <ul>
                    <li class="clearfix">
                        <dl class="clearfix">
                            <dt><spring:message code='usercenter.userInfo.msg56' /></dt>
                            <dd style="width: 500px">
                                <input class="txtPass" type="text" id="alipay" name="alipay" value="${sessionScope.curUser.alipay}"/>
                            </dd>
                        </dl>
                    </li>
                    <li class="clearfix">
                        <dl class="clearfix">
                            <dt>&nbsp;</dt>
                            <dd>
                                <input type="submit" value="<spring:message code='usercenter.userInfo.msg18' />" class="btnsubmit">
                            </dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</form>

<script>
//上传图片
//删除上传图片
function deleteImg(num,flag){
    //删除元素
    var url = $("#img_"+flag+"_"+num).attr("surl");
    $("#img_"+flag+"_"+num).remove();
    //为隐藏变量重新赋值
    var attachment = $("#attachment"+flag).val();
    var attachment2="";
    var indexa = attachment.indexOf(attachment);
    if(indexa != -1){
        var arr = attachment.split(",");
        if(arr.length >0 ){
            for(var i=0; i<arr.length; i++){
                var tempobj = arr[i];
                if(url == arr[i]){
                    arr.splice(i,1);
                }
            }
        }
        attachment2 = arr.join(",");
        $("#attachment"+flag).val(attachment2);
    }
}
//上传多个图片和删除
var uploadnum = 1;
function f_file_upload(fileflag){
    var fileId = 'fulAchievements'+fileflag;
    $.ajaxFileUpload({
        url: '${path}/fileUpload/upload_resource_file.html',
        secureuri: false,
        fileElementId: fileId,
        success: function (data) {
            //data = $.parseJSON(data);
            var data2 = data.split(",");
            var url = data2[0].replace(" ","");
            var fileName = data2[1].replace(" ","");

            var htmlStr = '<span id="img_'+fileflag+'_'+uploadnum+'" surl="'+url+'"><img src="${path}/'+url+'"  width="70" height="70" /><em class="ico_del"  onclick="deleteImg('+uploadnum+','+fileflag+')">×</em></span>';
            $("#imglist"+fileflag).append(htmlStr);
            if($("#attachment"+fileflag).val() == ''){
                $("#attachment"+fileflag).val(url);
            }else{
                $("#attachment"+fileflag).val($("#attachment"+fileflag).val()+","+url);
            }
            uploadnum++;
            //给图片绑定事件
        },
        error:function(data){

        }
    });
}
//上传单个图片
function f_file_upload_single(fileflag){
    var fileId = 'fulAchievements'+fileflag;
    var url = '${path}/fileUpload/upload_resource_file.html';
    if(fileflag == 4){
        url = '${path}/fileUpload/upload_resourceHead.html'
    }
    $.ajaxFileUpload({
        url: url,
        secureuri: false,
        fileElementId: fileId,
        success: function (data) {
            //data = $.parseJSON(data);
            var data2 = data.split(",");
            var url = data2[0].replace(" ","");
            var fileName = data2[1].replace(" ","");

            var htmlStr = '<span id="imgsingle'+fileflag+'" surl="'+url+'"><img src="${path}/'+url+'"  width="70" height="70" /></span>';
            $("#imglist"+fileflag).html(htmlStr);
            $("#attachment"+fileflag).val(url);
            //给图片绑定事件
        },
        error:function(data){

        }
    });
}

    $(function(){
        //认证真实姓名
        var validate1 = $("#frm1").validate({
            rules : {
                realName: {
                    required: true
                }
            },
            messages : {
                realName: {
                    required: "<spring:message code='usercenter.userInfo.msg30' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updateUserRealName.html",
                        $("#frm1").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg31' />");
                                window.location = '${path}/usercenter/getUserInfo.html';
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //更新密码
        var validate2 = $("#frm2").validate({
            rules : {
                oldPassword: {
                    required: true,
                    minlength: 6
                },
                newPassword: {
                    required: true,
                    minlength: 6
                },
                repeatPassword: {
                    required: true,
                    minlength: 6,
                    equalTo: "#newPassword"
                }
            },
            messages : {
                oldPassword: {
                    required: "<spring:message code='usercenter.userInfo.msg32' />",
                    minlength: "<spring:message code='usercenter.userInfo.msg33' />"
                },
                newPassword: {
                    required: "<spring:message code='usercenter.userInfo.msg32' />",
                    minlength: "<spring:message code='usercenter.userInfo.msg33' />"
                },
                repeatPassword: {
                    required: "<spring:message code='usercenter.userInfo.msg34' />",
                    minlength: "<spring:message code='usercenter.userInfo.msg35' />",
                    equalTo: "<spring:message code='usercenter.userInfo.msg36' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updatePassword.html",
                        $("#frm2").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg37' />");
                                toUrl('${path}/usercenter/getUserInfo.html');
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //更改头像
        var validate3 = $("#frm3").validate({
            rules : {
            },
            messages : {

            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updateUserHeadPortrait.html",
                        $("#frm3").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                //alert("<spring:message code='usercenter.userInfo.msg38' />");
                                $("#headPortrait").attr("src","${path}"+"/"+$("#attachment4").val());
                                window.location = '${path}/usercenter/getUserInfo.html';
                                //window.location.reload();
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //补充邮箱
        var validate4 = $("#frm4").validate({
            rules : {
                email :{
                    required: true,
                    email:true,
                    remote: {
                        url: "${path}/usercenter/checkUserEmail.html",     //后台处理程序
                        type: "get",               //数据发送方式
                        dataType: "json",           //接受数据格式
                        data: {                     //要传递的数据
                            email: function() {
                                return $("#email").val();
                            }
                        }
                    }
                }
            },
            messages : {
                email :{
                    required: "<spring:message code='usercenter.userInfo.msg39' />",
                    email: "<spring:message code='usercenter.userInfo.msg40' />",
                    remote: "<spring:message code='usercenter.userInfo.msg41' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updateUserEmail.html",
                        $("#frm4").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg42' />");
                                window.location = '${path}/usercenter/getUserInfo.html';
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //补充手机号码
        var validate5 = $("#frm5").validate({
            rules : {
                phone :{
                    required: true,
                    minlength: 11,
                    maxlength: 11,
                    digits:true,
                    remote: {
                        url: "${path}/usercenter/checkUserPhone.html",     //后台处理程序
                        type: "get",               //数据发送方式
                        dataType: "json",           //接受数据格式
                        data: {                     //要传递的数据
                            phone: function() {
                                return $("#phone").val();
                            }
                        }
                    }
                }
            },
            messages : {
                phone :{
                    required: "<spring:message code='usercenter.userInfo.msg43' />",
                    minlength: "<spring:message code='usercenter.userInfo.msg44' />",
                    maxlength: "<spring:message code='usercenter.userInfo.msg44' />",
                    digits:"<spring:message code='usercenter.userInfo.msg44' />",
                    remote: "<spring:message code='usercenter.userInfo.msg45' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updateUserPhone.html",
                        $("#frm5").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg46' />");
                                window.location = '${path}/usercenter/getUserInfo.html';
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //补充QQ号码
        var validate6 = $("#frm6").validate({
            rules : {
                userqq: {
                    required: true,
                    number:true,
                    minlength: 5
                }
            },
            messages : {
                userqq: {
                    required: "<spring:message code='usercenter.userInfo.msg47' />",
                    number: "<spring:message code='usercenter.userInfo.msg48' />",
                    minlength: "<spring:message code='usercenter.userInfo.msg49' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/updateUserqq.html",
                        $("#frm6").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg50' />！");
                                window.location = '${path}/usercenter/getUserInfo.html';
                            }else{
                                alert(data.errormsg);
                            }
                        },"json");
            }
        });
        //补充QQ号码
        var validate7 = $("#frm7").validate({
            rules : {
                alipay: {
                    required: true
                }
            },
            messages : {
                alipay: {
                    required: "<spring:message code='usercenter.userInfo.msg55' />"
                }
            },
            success: function(label) {//验证成功添加样式
                label.html("&nbsp;").removeClass("checked").addClass("checked");
            },
            submitHandler : function(){
                $.post("${path}/usercenter/authAlipay.html",
                        $("#frm7").serialize()
                        ,function(data){
                            if(data.errormsg == undefined){
                                alert("<spring:message code='usercenter.userInfo.msg53' />！");
                                window.location = '${path}/usercenter/getUserInfo.html';
                            }else{
                                alert("<spring:message code='usercenter.userInfo.msg52' />！");
                            }
                        },"json");
            }
        });
    });
    var type=1;
    $(window).resize(function() {
        UpdateSize(type);
    });
    function closeWin(type){
        $("#openwin"+type).hide();
    }
    function openWin(type){
        $("#openwin"+type).show();
        type = type;
        UpdateSize(type);
    }
    function UpdateSize(type){
        var _width= parseFloat($(document).width());
        var _height=parseFloat($(window).height());
        if(_width<900){ _width=900;}
        if(_height<600){ _height=600;}
        var open_height=parseFloat($("#openbox"+type).height());
        if(_height<open_height){_height=open_height;}
        var open_mt=(_height-open_height)/2;

        $("#openbox"+type).css({"margin-top":open_mt+"px"});
        $("#openwin"+type).css({"width":_width+"px","height":_height+"px"});
    }


</script>
<!--弹出框-->
<jsp:include page="../usercenter/leftMenuEnd.jsp"></jsp:include>
<jsp:include page="../public/footer.jsp"></jsp:include>
</body>
</html>